package com.whiteblue.model;

import com.whiteblue.tool.Model;

import java.util.List;

/**
 * Created by WhiteBlue on 15/4/5.
 */
public class Category extends Model<Category> {
    public static final Category dao=new Category();

    public static final String CATEGORY_CACHE="category";

    public Category() {
        super(CATEGORY_CACHE);
    }

    public List<Category> listBySort(int sort){
        return loadModelList(dao.find("select id from b_category where sort = ?",sort));
    }

    public List<Category> listAll(){
        return loadModelList(dao.find("select id from b_category"));
    }

    public Category getById(int Id){
        return loadModel(Id);
    }

    public Sort getSort(){
        return Sort.dao.getById(this.getInt("sortId"));
    }

}
